{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4d1cb343",
   "metadata": {},
   "source": [
    "# 本周学习内容\n",
    "\n",
    "### 1.Head First Python P4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b6d296a8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "37b5ff2b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "362716\n",
      "This minute seems a little odd.\n",
      "362716\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "# 本项目用到了时间模块\n",
    "print(datetime.datetime.today().microsecond)\n",
    "\n",
    "odds = [  1, 3,  5,  7,  9, 11,13,15,17,19,\n",
    "             21,23,25,27,29,31,33,35,37,39,\n",
    "             41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "right_this_minute = datetime.datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")\n",
    "\n",
    "print(datetime.datetime.today().microsecond)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c80a6df2",
   "metadata": {},
   "source": [
    "## 2.1 模块--标准库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "363c68bb",
   "metadata": {},
   "source": [
    "> - 标准库是Python开发团队为满足Python用户日常需求而写好的一些模块，可以直接使用： import 模块名称"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a8b5c700",
   "metadata": {},
   "source": [
    "> 1.sys模板\n",
    ">\n",
    "> 2.os模板\n",
    ">\n",
    "> 3.datetime模板"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "76fb9f90",
   "metadata": {},
   "source": [
    "# 2.2模块--开源模块（pypi.org）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0f1207d4",
   "metadata": {},
   "source": [
    "# 2.3自定义模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0ccb64cd",
   "metadata": {},
   "outputs": [],
   "source": [
    " import sys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "794acd62",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'sys' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [2]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43msys\u001b[49m\u001b[38;5;241m.\u001b[39mversion\n",
      "\u001b[1;31mNameError\u001b[0m: name 'sys' is not defined"
     ]
    }
   ],
   "source": [
    " sys.version"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1a8b4dec",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ccfe36cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\2022-2021\\\\python'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.getcwd()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "1b49addd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1554c7dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2022, 8, 30)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.date.today()"
   ]
  },
  {
   "cell_type": "raw",
   "id": "4f706f3f",
   "metadata": {},
   "source": [
    "# 认识下 time模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "7d065309",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a67173d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=8, tm_mday=30, tm_hour=16, tm_min=2, tm_sec=31, tm_wday=1, tm_yday=242, tm_isdst=0)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "90de5e4f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1661846571.5312116"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time() # 时间戳"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "adff8400",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "52.696809482328106"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()/60/60/24/365"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2ad06ca8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1970"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2022-52"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3a989167",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=8, tm_mday=30, tm_hour=8, tm_min=3, tm_sec=16, tm_wday=1, tm_yday=242, tm_isdst=0)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "78353f70",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'apple'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Input \u001b[1;32mIn [15]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mapple\u001b[39;00m\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'apple'"
     ]
    }
   ],
   "source": [
    "import apple"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "57d74d71",
   "metadata": {},
   "source": [
    "# 3赋值"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "13f9d588",
   "metadata": {},
   "source": [
    "# 4变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a14d68bd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
